package com.encryption.feature.doc.ui.render
{
	import com.encryption.rpc.cache.FileLevelManager;
	import com.encryption.rpc.model.File;
	import com.encryption.rpc.model.FileLevel;
	
	import mx.controls.Label;

	public class FileLevelItemRenderer extends Label
	{
		private var _file:File;
		
		public function FileLevelItemRenderer()
		{
		}
		
		override public function set data(value:Object):void
		{
			if(value == null)
				return;
			_file = value as File;
			
			FileLevelManager.instance.addInitListener(setFileLevelName);
		}
		
		private function setFileLevelName():void
		{
			if(_file == null)
				return;
			
			var fileLevel:FileLevel = FileLevelManager.instance.getById(_file.fileLevel) as FileLevel;
			if(fileLevel != null)
				text = fileLevel.toString();
		}
		
	}
}